package com.ruidan.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.struts.action.Action;
import org.struts.form.ActionForm;

import com.ruidan.form.LoginForm;
import com.ruidan.service.LoginService;
import com.ruidan.service.impl.loginServiceImpl;
import com.ruidan.service.vo.MessageVo;

public class LoginAction implements Action{

	@Override
	public String execute(HttpServletRequest request,HttpServletResponse response, ActionForm actionForm) {
		String url="";
		LoginForm loginForm = (LoginForm) actionForm;
		 LoginService loginService = new loginServiceImpl();
		 MessageVo user = loginService.isUser(loginForm);
		if(user.isFlag()){
			url ="success";
		}else{
			url ="error";
		}
		request.setAttribute("message", user.getMessage());
		return url;
	}

	

}
